<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script>

if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

var subframeURL = "resources/object-as-frame-subframe-new.html";
var updatedFrameHash = "#updated-contents-of-iframe";
var updatedObjectHash = "#updated-contents-of-object";

function runTests()
{
    shouldBe("window.frames.length", "2");
    shouldBe("window.frames[0].frameElement.name", '"frame"');
    shouldBe("window.frames[1].frameElement.name", '"obj"');

    document.getElementsByName('frame')[0].onload = handleLoad;
    document.getElementsByName('obj')[0].onload = handleLoad;

    let updatedFrameURL = subframeURL + updatedFrameHash;
    let updatedObjectURL = subframeURL + updatedObjectHash;
    debug("Loading '" + updatedFrameURL + "' in iframe...");
    debug("Loading '" + updatedObjectURL + "' in object...");
    open(updatedFrameURL, "frame");
    open(updatedObjectURL, "obj");
}

var numLoads = 0;

function handleLoad()
{
    numLoads++;
    if (numLoads < 2)
        return;

    shouldBe("window.frames[0].location.hash", '"' + updatedFrameHash + '"');
    shouldBe("window.frames[1].location.hash", '"' + updatedObjectHash + '"');
    if (window.testRunner) {
        testRunner.notifyDone();
    }
}
</script>

</head>
<body onload="runTests()">

<iframe name="frame" src="resources/object-as-frame-subframe-old.html#old-contents-of-iframe"></iframe>
<object name="obj" type="text/html" data="resources/object-as-frame-subframe-old.html#old-contents-of-object"></object>

</body>
</html>
